# -*- coding: UTF-8 -*-

from google.appengine.ext import db

class Album_Page (webapp.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/html'
        template_values = {
                           'sWebTitle': web_configuration.Web_Title,
                           'lMainMenu': web_configuration.Main_Menu,
                           'sCopyRight': web_configuration.Web_Copyright,
                           'sHomeTitle': web_home.Home_Title,
                           'sHomeContent': web_home.Home_Content,
         }
        path = os.path.join(os.path.dirname(__file__), "template/album.html")
        self.response.out.write(template.render(path, template_values))
    

class Album_Image (webapp.RequestHandler):
    
    
    def get(self):
        curr_user = self.request.get("id")
        if curr_user == 0:
            self.response.out.write("No image")
        else:
            if curr_user.photo:
                self.response.headers['Content-Type'] = "image/jpg"
                self.response.out.write(curr_user.photo)
            else:
                self.response.out.write("No image")

class Album_Manage (webapp.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/html'
        template_values = {
                           'sWebTitle': web_configuration.Web_Title,
                           'lMainMenu': web_configuration.Main_Menu,
                           'sCopyRight': web_configuration.Web_Copyright,
                           'sHomeTitle': web_home.Home_Title,
                           'sHomeContent': web_home.Home_Content,
         }
        path = os.path.join(os.path.dirname(__file__), "template/album_manage.html")
        self.response.out.write(template.render(path, template_values))
        

class Album_Object (db.Model):
    title = db.StringProperty()
    describe = db.StringProperty()
    img = db.BlobProperty() 
    